babl: use _aligned_malloc() instead of aligned_alloc() on Win32.
authorJehan <jehan@girinstud.io>
Sat, 2 Sep 2017 12:18:07 +0000 (14:18 +0200)
committerJehan <jehan@girinstud.io>
Sat, 2 Sep 2017 12:18:07 +0000 (14:18 +0200)
Thanks to Lionel N. for raising the issue. It was failing to build for
Windows with:
> babl/babl-space.c:503: undefined reference to `aligned_alloc'
Windows has apparently a similar API, except that the size and alignment
parameters are inverted.
See https://msdn.microsoft.com/library/8z34s9c6.aspx

babl/babl-space.c

index 77fc1ec45048093db9d62936e07694d510586000..23a1c3e00c2f6ddffe16435791eb797efbc94355 100644 (file)
@@ -500,7 +500,11 @@ universal_nonlinear_rgba_u8_converter (const Babl *conversion,unsigned char *src
   uint8_t *rgba_in_u8 = (void*)src_char;
   uint8_t *rgba_out_u8 = (void*)dst_char;
 
+#ifndef  _WIN32
   float *rgb = aligned_alloc (16, sizeof(float) * 4 * samples);
+#else
+  float *rgb = _aligned_malloc (sizeof(float) * 4 * samples, 16);
+#endif
 
   for (i = 0; i < samples; i++)
   {
@@ -642,7 +646,11 @@ universal_nonlinear_rgba_u8_converter_sse2 (const Babl *conversion,unsigned char
   uint8_t *rgba_in_u8 = (void*)src_char;
   uint8_t *rgba_out_u8 = (void*)dst_char;
 
+#ifndef  _WIN32
   float *rgb = aligned_alloc (16, sizeof(float) * 4 * samples);
+#else
+  float *rgb = _aligned_malloc (sizeof(float) * 4 * samples, 16);
+#endif
 
   for (i = 0; i < samples; i++)
   {